package com.mhkj.base.rbac.user.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.mhkj.base.rbac.role.entity.SystemRole;
import com.mics.core.common.validate.annotation.Unique;
import com.mics.core.system.base.entity.BaseDomain;

/**
 * 系统用户
 * @author mics
 * @date 2018年9月1日
 * @version 1.0
 */
@Entity
@Table(name="t_system_user")
public class SystemUser extends BaseDomain{

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -5961139441061469664L;

	/**
	 * 姓名
	 */
	@Column(name="name",length=48)
	private String name;
	
	/**
	 * 编码
	 */
	@Column(name="code",length=48)
	private String code;
	
	/**
	 * oa关系id
	 */
	@Column(name="oa_id")
	private String oaId;
	
	/**
	 * oa登陆账号
	 */
	@Column(name="login_name",length=48)
	@Unique(message="登陆账号不能重复")
	private String loginName;
	
	/**
	 * 系统角色
	 */
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name = "t_sys_role_user",joinColumns = {@JoinColumn(name = "sysUser_id", referencedColumnName = "id")},
	inverseJoinColumns = {@JoinColumn(name = "sysRole_id", referencedColumnName ="id")})
	private List<SystemRole> systemRoles;
	



	
	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getOaId() {
		return oaId;
	}

	public void setOaId(String oaId) {
		this.oaId = oaId;
	}

	public List<SystemRole> getSystemRoles() {
		return systemRoles;
	}

	public void setSystemRoles(List<SystemRole> systemRoles) {
		this.systemRoles = systemRoles;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	
}
